Sound encoder and sound decoder

ABSTRACT

A sound encoder multiplexes a plurality of codes into a sound code in an order determined by a multiplexing order determination unit ( 12 ), and a sound decoder demultiplexes the sound code into a plurality of codes one by one in an order determined by a demultiplexing order determination unit ( 14 ).

BACKGROUND OF THE INVENTION

1. Field of the Invention

This application is a Divisional of co-pending application Ser. No.11/701,461, filed on Feb. 2, 2007, which is a Divisional of co-pendingapplication Ser. No. 10/222,902, filed on Aug. 19, 2002, which claimspriority to Japanese Application No. 2001-266253, filed Sep. 3, 2001,the entire contents of which are hereby incorporated by reference andfor which priority is claimed under 35 U.S.C. § 120.

The present invention relates to a sound encoder that outputs a soundcode acquired by compressing a digital sound signal, such as a musicalsound or a voice, into a small volume of information, and a sounddecoder that decodes the sound code so as to reproduce a sound signal.

2. Description of the Prior Art

Most prior art sound encoders acquire a plurality of codes having asmall volume of information from a sound signal, and multiplex them intoa sound code. Most prior art sound decoders demultiplex the sound codeinto a plurality of codes and decode them so as to reproduce the soundsignal.

In a sound encoder and a sound decoder disclosed in “ITU-TRecommendation G.722.” (in September, 1999), a Huffman code is used as apart of codes in order to reproduce an excellent sound signal even whenthose codes have a small amount of information. Huffman codes aretypical variable length codes having a feature that their code lengthbecomes short when they have a frequently used value and becomes longotherwise.

FIG. 10 is a block diagram showing the structure of a prior art soundencoder as disclosed in the above-mentioned reference, and FIG. 11 is ablock diagram showing the structure of a prior art sound decoder asdisclosed in the above-mentioned reference. In the figures, referencenumeral 1 denotes an encoding means for encoding a sound signal, whichis the target to be coded, so as to produce and output a plurality ofcodes (i.e., an envelope code and a plurality of band-by-band codes),and reference numeral 2 denotes a multiplexing unit for multiplexing theplurality of codes output from the encoding means 1 into a multiplexedcode and for outputting the multiplexed code as a sound code, referencenumeral 3 denotes a demultiplexing means for accepting the sound codefrom the sound encoder and for demultiplexing the sound code into theplurality of codes (i.e., the envelope code and the plurality ofband-by-band codes), and reference numeral 4 denotes a decoding meansfor decoding the plurality of codes demultiplexed by the demultiplexingmeans 3 so as to reproduce the sound signal.

Next, a description will be made as to the operation of the prior artsound encoder. The prior art sound encoder performs all processes on aframe-by-frame basis, each frame having a length of 20 ms. When a soundsignal is input to the encoding means 1 of the prior art sound encoder,the encoding means 1 performs a modulated lapped transform (MLT) on thesound signal so as to acquire MLT coefficients and divides these MLTcoefficients into a plurality of regions. The encoding means 1 thencalculates a mean value of the MLT coefficients for each region andencodes an amplitude envelope which consists of a plurality of acquiredmean values so as to output the coded amplitude envelope as an envelopecode. The encoding means 1 then normalizes the MLT coefficients for eachregion with a value obtained by decoding the envelope code, quantizesthe normalized MLT coefficients for each region, and acquires a fixedlength code of length which is fixed for each quantization. The encodingmeans 1 Huffman-encodes (variable-length encodes) this fixed length codeand outputs the acquired variable length code as each band-by-band code.The encoding means 1 further determines and outputs a category code of afixed length for controlling the quantization stepsize for each regionin addition to the envelope code and the plurality of band-by-bandcodes. However, for simplicity, the detailed explanation of the categorycode will be omitted hereafter.

When the encoding means 1 outputs the envelope code and the plurality ofband-by-band codes, the multiplexing means 2 multiplexes them in a fixedorder which is provided in advance and outputs the multiplexed result tothe sound decoder as a sound code.

The demultiplexing means 3 of the sound decoder accepts the sound codefrom the sound encoder and demultiplexes the sound code into a pluralityof codes so that they are arranged in the fixed order which is providedin advance and outputs the plurality of codes (i.e., the envelope codeand the plurality of band-by-band codes).

When receiving the envelope code and the plurality of band-by-band codesfrom the demultiplexing means 3, the decoding means 4 decodes theenvelope code so as to calculate an amplitude envelope, decodes theplurality of band-by-band codes so as to calculate normalized frequencydomain coefficients. By multiplying the value of the amplitude envelopefor each region by the normalized frequency domain coefficients for eachregion, the decoding means 4 denormalize the frequency domaincoefficients and performs an Inverse MLT (IMLT) on the denormalizedfrequency domain coefficients so as to reproduce a sound signal.

FIG. 12 is an explanatory drawing for showing an example of theamplitude envelope generated by the prior art sound encoder. In FIG. 12,the horizontal axis indicates the frequency and the vertical axisindicate the value, i.e., envelope value of the amplitude envelope foreach region. The total frequency region of the sound signal which is thetarget to be coded is divided into fourteen regions, and these fourteenregions starting from the lowest-frequency region are consecutivelynumbered with numbers in ascending order. The amplitude envelope thusbecomes a fourteen-dimensional vector having mean values of thefrequency domain coefficients for the fourteen frequency regions asfourteen elements of the vector, and an envelope code is obtained as aresult of encoding the amplitude envelope.

FIG. 13 is an explanatory drawing for explaining the structure of thesound code in the case of the amplitude envelope of FIG. 12. Themultiplexing means 2 multiplexes the plurality of variable-length codes(i.e., Huffman codes), i.e., the plurality of band-by-band codesrespectively provided for the plurality of regions so that the pluralityof band-by-band codes are arranged in increasing order of theirrespective frequencies, after multiplexing the envelope code. When a biterror occurs in the same bit position designated by X as that shown inFIG. 13, the band-by-band code numbered 6 separated by thedemultiplexing unit 15 of the sound decoder differs from the originalone multiplexed by the sound encoder. Since a Huffman code is used aseach of the plurality of band-by-band codes, the code length of theband-by-band code numbered 6 can be erroneously estimated with aconsiderable probability.

As a result, since the demultiplexing means 15 cannot separate theband-by-band codes 102-3 numbered 7, 9, 10, 11, 13, and 14, whichfollows the one numbered 6, from correct locations of the multiplexedcode, the following codes separated by the demultiplexing means 15become erroneous ones. These erroneously decoded regions are hatched inFIGS. 3 and 4. Thus, in the prior art sound encoder and the prior artsound decoder, since band-by-band codes provided for high-frequencyregions are often multiplexed fixedly into locations closer to the tailof the multiplexed code, there is a possibility that such band-by-bandcodes are separated erroneously when an bit error occurs before thelocations where they are multiplexed.

Japanese patent application publications No. 9-106299 and 2000-183751disclose sound encoders and sound decoders different from theabove-mentioned prior art example. The prior art sound encoder disclosedin Japanese patent application publication No. 9-106299 encodes only aselected, predetermined number of partial frequency domain coefficients(their respective amplitudes) with a larger value in order to selectonly the necessary ones from among all samples of frequency domaincoefficients into which the sound signal is time-to-frequency domainconverted and to encode them with a high degree of efficiency. Theencoding of the partial frequency domain coefficients is carried out insuch a manner that they are encoded in decreasing order of their values,when encoding the second or later largest coefficient the coefficientencoded immediately before the encoding is decoded, and the second orlater largest coefficient is encoded after it is normalized with thedecoded coefficient. Information indicating the order in which thepartial frequency domain coefficients are to be encoded can be samplenumbers which are converted into binary numbers, or a series of samplenumbers, which is Huffman encoded, and is transmitted from the soundencoder to the sound decoder.

The prior art sound encoder disclosed in Japanese patent applicationpublication No. 2000-183751 sorts data to be encoded according to apredetermined reference, such as bits of each data to be encoded, or bitsensitivities determined based on data errors, in order to implementchangeable bit rate encoding which is synchronized in real time withtraffic (or transmission line congestions). The order of sorting data ispredetermined to ensure that the data can be transmitted between theencoding side and the decoding side. In other words, the order ofsorting data is so fixed as not to vary from frame to frame.

A problem with such a prior art sound encoder and such a sound decoderconstructed as above is that since the order in which a plurality ofband-by-band codes which are variable length codes is so fixed as not tovary from frame to frame, erroneous demultiplexing can often occur inband-by-band codes provided for high-frequency regions, which aremultiplexed in locations closer to the tail of the multiplexed code.Another problem is that since the deterioration in the tone quality ofthe sound signal increases when band-by-band codes with a largerenvelope value are erroneously separated, the deterioration in the tonequality of the sound signal increases due to the occurrence of biterrors when band-by-band codes provided for high-frequency regions havea larger envelope value. In other words, since the multiplexing is notcarried out in consideration of the distribution of bit errorsensitivities that varies from frame to frame, the deterioration in thetone quality of the sound signal increases due to the occurrence of biterrors.

The prior art sound encoder and the prior art sound decoder disclosed inJapanese patent application publication No. 9-106299, do not has amethod of sufficiently preventing the deterioration in the sound signaldue to the occurrence of bit errors by using an error correction code,but only has a modified encoding unit. Japanese patent applicationpublication No. 9-106299 discloses a method of adding a code indicatingthe order in which partial frequency domain coefficients are to beencoded and encoding it by using a Huffman code. The other codes otherthan the code indicating the order are fixed length codes and thereforethe problem of the occurrence of erroneous demultiplexing caused by theexistence of variable length codes cannot be solved. If anything, thedeterioration in the sound signal due to the occurrence of bit errorsincreases because of the addition of the code associated with the orderin which partial frequency domain coefficients are to be encoded and theencoding of the second or later largest partial frequency domaincoefficient after decoding the immediately-encoded partial frequencydomain coefficient and normalizing the second or later largest partialfrequency domain coefficient with the decoded value.

A problem with prior art sound encoder and prior art sound decoders asdisclosed in Japanese patent application publication No. 2000-183751 isthat since the sound encoder does not perform multiplexing that reflectsthe distribution of bit error sensibilities that varies from frame toframe, but only sorts data to be encoded according to a predeterminedreference so that they are arranged in a fixed order that does not varyfrom frame to frame, the deterioration in the sound signal due to theoccurrence of bit errors cannot be sufficiently prevented, as in thecase of the prior art sound encoder and the prior art sound decoder asshown in FIGS. 10 and 11.

SUMMARY OF THE INVENTION

The present invention is proposed to solve the above-mentioned problems,and it is therefore an object of the present invention to provide asound encoder and a sound decoder having high bit error immunity.

In accordance with an aspect of the present invention, there is provideda sound encoder including: a multiplexing order determination unit foranalyzing the plurality of codes produced by an encoding unit so as todetermine an order in which the plurality of codes are to bemultiplexed; and a multiplexing unit for multiplexing the plurality ofcodes in the order determined by the multiplexing order determinationunit, and for outputting a multiplexed result as a sound code. As aresult, the sound encoder can provide high bit error immunity.

In accordance with another aspect of the present invention, there isprovided a sound decoder comprising: a demultiplexing orderdetermination unit for accepting a sound code on a frame-by-frame basis,and for determining an order in which the sound code is to bedemultiplexed into a plurality of codes part or all of which arevariable length codes; and a demultiplexing unit for demultiplexing asound code into a plurality of codes one by one in the order determinedby the demultiplexing order determination unit and for outputting them.As a result, the sound decoder can provide high bit error immunity.

Further objects and advantages of the present invention will be apparentfrom the following description of the preferred embodiments of theinvention as illustrated in the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing the structure of a sound encoderaccording to embodiment 1 of the present invention;

FIG. 2 is a block diagram showing the structure of a sound decoderaccording to embodiment 1 of the present invention;

FIG. 3 is an explanatory drawing for showing an example of an amplitudeenvelope calculated by the sound encoder according to embodiment 1 ofthe present invention;

FIG. 4 is explanatory drawing for explaining the structure of a soundcode to in the case of the amplitude envelope of FIG. 3;

FIG. 5 is an explanatory drawing for showing an evaluation result of biterror sensibility when a voice is input as the sound signal;

FIG. 6 is a block diagram showing the structure of a sound encoderaccording to embodiment 2 of the present invention;

FIG. 7 is a block diagram showing the structure of a sound decoderaccording to embodiment 2 of the present invention;

FIG. 8 is an explanatory drawing for explaining a power for eachsubframe in the sound encoder according to embodiment 2 of the presentinvention;

FIG. 9 is an explanatory drawing for explaining the structure of a soundcode output by the sound encoder according to embodiment 2 of thepresent invention;

FIG. 10 is a block diagram showing the structure of a prior art soundencoder;

FIG. 11 is a block diagram showing the structure of a prior art sounddecoder;

FIG. 12 is an explanatory drawing for showing an example of an amplitudeenvelope calculated by the prior art sound encoder; and

FIG. 13 is an explanatory drawing for explaining the structure of thesound code in the case of the amplitude envelope of FIG. 12.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

The invention will now be described with reference to the accompanyingdrawings.

Embodiment 1

FIG. 1 is a block diagram showing the structure of a sound encoderaccording to embodiment 1 of the present invention, and FIG. 2 is ablock diagram showing the structure of a sound decoder according toembodiment 1 of the present invention. In the figure, reference numeral11 denotes an encoding unit that accepts a sound signal, which is thetarget to be encoded, for each frame of a predetermined length, andencodes the sound signal so as to produce a plurality of codes, such asan envelope code and a plurality of band-by-band codes, referencenumeral 12 denotes a multiplexing order determination unit fordetermining the order in which the plurality of band-by-band codes areto be multiplexed into a multiplexed code based on the envelope codeoutput from the encoding unit 11, reference numeral 13 denotes amultiplexing unit for multiplexing the envelope code and the pluralityof band-by-band codes in the order determined by the multiplexing orderdetermination unit 12, and for outputting the multiplexed result as asound code, reference numeral 14 denotes a demultiplexing orderdetermination unit for determining the order in which the sound code isto be demultiplexed into a plurality of codes, reference numeral 15denotes a demultiplexing unit for demultiplexing the sound code into theplurality of codes, such as the envelope code and the plurality ofband-by-band codes, one by one in the order determined by thedemultiplexing order determination unit 14 and for outputting them, andreference numeral 16 denotes a decoding unit for decoding the envelopecode and the plurality of band-by-band codes output from thedemultiplexing unit 15 so as to reproduce and output a sound signal.

Next, a description will be made as to the operation of the soundencoder and the operation of the sound decoder in accordance withembodiment 1 of the present invention. The sound encoder performs allprocesses on a frame-by-frame basis, each frame having a length of 20ms, for example. When a sound signal is input to the encoding unit 11 ofthe sound encoder, the encoding unit 11 performs a time to frequencydomain transformation, such as a modulated lapped transform (MLT), onthe sound signal so as to acquire frequency domain coefficients anddivides these frequency domain coefficients into a plurality of portionsrespectively provided for a plurality of regions. In other words, theplurality of portions which constitute each frame correspond to theplurality of frequency regions into which a frequency spectrum obtainedby converting the sound signal from time domain to frequency domain isdivided, respectively.

The encoding unit 11 then calculates a mean value of the frequencydomain coefficients for each region and encodes an amplitude envelopethat consists of a plurality of acquired mean values so as to output thecoded amplitude envelope as an envelope code. The encoding unit 11 thennormalizes the frequency domain coefficients for each region with avalue obtained by decoding the envelope code, quantizes the normalizedfrequency domain coefficients for each region, and acquires a fixedlength code of length which is fixed for each quantization. The encodingunit 11 Huffman-encodes (variable-length encodes) this fixed length codeand outputs the acquired variable length code as each band-by-band code.The encoding unit 11 can further determine and output a category controlcode of a fixed length for controlling the quantization stepsize foreach region in addition to the envelope code and the plurality ofband-by-band codes, and can multiplex the category control code as wellas the envelope code and the plurality of band-by-band codes into amultiplexed code.

When receiving the plurality of codes from the encoding unit 11, themultiplexing order determination unit 12 classifies the plurality ofband-by-band codes as main codes and classifies the remaining envelopecode as an auxiliary code. The multiplexing order determination unit 12then determines the order in which the plurality of band-by-band codes,which are main codes, are to be multiplexed into the multiplexed codebased on the envelope code which is an auxiliary code.

Concretely, the multiplexing order determination unit 12 determines theorder in the following manner. While keeping the order in which theenvelope code, which is an auxiliary code, is to be multiplexed into themultiplexed code fixed so that it does not vary from frame to frame, themultiplexing order determination unit 12 determines the order in whichthe plurality of band-by-band codes, which are main codes, are to bemultiplexed into the multiplexed code in the order of the values of theamplitude envelope's elements obtained by decoding the envelope code,for example. Since the amplitude envelope is calculated as anintermediate variable in the encoding unit 11, it is possible to omitthe decoding of the amplitude envelope in the multiplexing orderdetermination unit 12 by delivering the amplitude envelope from theencoding unit 11 to the multiplexing order determination unit 12. Theorder does not simply indicate the order in which processes are to bedone with time, but indicates where the plurality of codes are to beplaced in the sound code into which they are to be multiplexed by themultiplexing unit 13.

When receiving the plurality of codes from the encoding unit 11, themultiplexing unit 13 multiplexes the envelope code and the plurality ofband-by-band codes in the order determined by the multiplexing orderdetermination unit 12 and then outputs the multiplexed result as a soundcode.

When receiving the sound code from the sound encoder, the demultiplexingunit 15 of the sound decoder separates only the auxiliary code, i.e.,the envelope code from the sound code, and then outputs it. Thedemultiplexing unit 14 can separate only the auxiliary code withouthaving to wait for inputting of the order determined on a frame-by-framebasis because the order in which the auxiliary code is multiplexed intothe received multiplexed code is fixed in the multiplexing orderdetermination unit 12 of the corresponding sound encoder.

When receiving the envelope code which is an auxiliary code from thedemultiplexing unit 15, the demultiplexing order determination unit 14determines the order in which the plurality of main codes are to beseparated by the demultiplexing unit 15 based on the envelope code. Themethod of determining the order has to be made to be the same as thatused by the multiplexing order determination unit 12 of thecorresponding sound encoder. When the amplitude envelope can becalculated prior to the processing done by the demultiplexing orderdetermination unit 14 within the decoding unit 16, it is possible toomit the decoding of the envelope code in the demultiplexing orderdetermination unit 14 by delivering the amplitude envelope from thedecoding unit 16 to the demultiplexing order determination unit 15.

The demultiplexing unit 15 separates the plurality of main codes, i.e.,the plurality of band-by-band codes from the sound code in the orderdetermined by the demultiplexing order determination unit 14 and thenoutputs them. When receiving the envelope code and the plurality ofband-by-band codes from the demultiplexing unit 15, the decoding unit 16decodes the envelope code so as to calculate the amplitude envelope anddecodes the plurality of band-by-band codes so as to calculate thenormalized frequency domain coefficients. The demultiplexing unit 15then denormalizes the frequency domain coefficients by multiplying thevalue of the amplitude envelope for each region by the normalizedfrequency domain coefficients for each region, and performs a frequencyto time domain transformation, such as an Inverse MLT (IMLT), on thedenormalized frequency domain coefficients for each region so as toreproduce a sound signal.

FIG. 3 is an explanatory drawing for showing an example of the amplitudeenvelope calculated by the sound encoder. In FIG. 3, the horizontal axisindicates the frequency and the vertical axis indicates the value, i.e.,the envelope value of each element of the amplitude envelope for eachregion. The total frequency region of the sound signal which is thetarget to be encoded is divided into fourteen regions, and thesefourteen regions starting from the lowest-frequency region areconsecutively numbered with numbers in ascending order. The amplitudeenvelope is a fourteen-dimensional vector having mean values of thefourteen portions of the frequency domain coefficients for the fourteenfrequency regions as fourteen elements of the vector, and the envelopecode is obtained as a result of encoding the amplitude envelope. Theamplitude envelope shown in FIG. 3 has the same envelope values as thoseas shown in FIG. 12.

In the case of the amplitude envelope of FIG. 3, the regions numbered 4,8, and 12 have a larger envelope value than the other regions, and theorder of the envelope values is as shown in the lowest part of FIG. 3.Each of the multiplexing order determination unit 12 and thedemultiplexing order determination unit 14 decodes the input envelopecode so as to calculate the order of the envelope values for theacquired amplitude envelope on a frame-by-frame basis.

FIG. 4 is an explanatory drawing for explaining the structure of thesound code in the case of the amplitude envelope of FIG. 3. Themultiplexing unit 13 multiplexes the envelope code into the head of themultiplexed code, and multiplexes the plurality of variable lengthcodes, which are provided for the plurality of regions, respectively,i.e., the plurality of band-by-band codes into the multiplexed code inthe above-mentioned order of the plurality of corresponding envelopevalues calculated on a frame-by-frame basis. Concretely, themultiplexing unit 13 multiplexes the band-by-band code numbered 4 andhaving the first order of envelope value, i.e., having the largestenvelope value into an area of the multiplexed code next to the area inwhich the envelope code is placed. The multiplexing unit 13 thenmultiplexes the band-by-band code numbered 8 and having the second orderof envelope value, i.e., having the second largest envelope value intoan area of the multiplexed code next to the area in which theband-by-band code numbered 4 is placed. The multiplexing unit 13repeatedly and sequentially multiplexes up to the band-by-band codenumbered 14 and having the fourteenth order of envelope value, i.e.,having the smallest envelope value. It is apparent from the comparisonwith the prior art sound code shown in FIG. 13 that the order in whichthe plurality of band-by-band codes are to be multiplexed differs fromthat of FIG. 13.

When a bit error occurs in the same bit position designated by X as thatshown in FIG. 13, the band-by-band code numbered 6 separated by thedemultiplexing unit 15 of the sound decoder differs from the originalone multiplexed by the sound encoder. Since a Huffman code is used aseach of the plurality of band-by-band codes, the code length of theband-by-band code numbered 6 can be erroneously estimated with aconsiderable probability. As a result, since the demultiplexing unit 15cannot separate the band-by-band codes numbered 7, 9, 10, 11, 13, and14, which follow the one numbered 6, from correct areas of themultiplexed code, these following codes separated by the demultiplexingunit 15 become erroneous ones. Those erroneously decoded regions arehatched in FIGS. 3 and 4.

It is apparent from the comparison between the erroneously decodedregions shown in FIG. 3 and those shown in FIG. 13 that the band-by-bandcode numbered 12 associated with a region having a large envelope valueis not decoded erroneously, while the number of band-by-band codesdecoded erroneously and associated with regions having a small envelopevalue increases. Since the tone quality of the reproduced sound signaldeteriorates when one band-by-band code associated with a region havinga large envelope value, i.e., a large power is erroneously decoded, thedeterioration in the tone quality decreases as compared withabove-mentioned prior art examples. Thus, the present embodiment makesit possible to lower the probability of erroneously decodingband-by-band codes associated with regions which are determined to exerta large influence of errors (i.e., regions having a large envelope valuein this case) by multiplexing those band-by-band codes into themultiplexed code so that they are arranged in areas closer to the headof the multiplexed code, thereby reducing the deterioration in the tonequality of the sound signal.

FIG. 5 shows results of an evaluation of bit error sensibilities when avoice is input as the sound signal. In the figure, the horizontal axisindicates the position of each bit of the sound code, and the leftmostend of the axis corresponds to the head bit of the sound code and therightmost end of the axis corresponds to the tail bit of the sound code.When the sound signal output from the sound decoder when a bit erroroccurs in each bit of the sound code is x (t) and the sound signaloutput from the sound decoder when no bit error occurs is s (t), and thevertical axis indicates the signal to noise ratio SNR, the signal tonoise ratio SNR is given by the following equation: 1SNR=logs(t)2(s(t)−x(t))2

The larger the signal to noise ratio, the less the deterioration in thetone quality in FIG. 5. It is apparent from the comparison withabove-mentioned prior art examples, as shown in FIG. 5, that thestructure of this embodiment 1 makes the signal to noise ratio SNR ofthe sound signal larger, thereby reducing the deterioration in the tonequality of the sound signal due to the occurrence of bit errors.Furthermore, it is understood that even when the sound code is partiallyprotected by using an error correction code an improvement can beeffected in the remaining region not protected, because the improvementis effected in most of the bit positions of the sound code.

In this embodiment 1, only the envelope code is used as an auxiliarycode to determine the order in which the plurality of input codes are tobe multiplexed into the multiplexed code and the multiplexed code is tobe demultiplexed into a plurality of output codes. The present inventionis not limited to this case, and various variants can be made. Forexample, a category control code for controlling the quantizationstepsize can be multiplexed into the multiplexed code and the order inwhich the plurality of input codes are to be multiplexed into themultiplexed code can be modified according to the category control code.Furthermore, in this embodiment 1, the order of the values of theamplitude envelope's elements obtained by decoding the envelope code isused unchanged as the order in which the plurality of input codes are tobe multiplexed into the multiplexed code. As an alternative, it ispossible to determine the order in which the plurality of input codesare to be multiplexed into the multiplexed code based on the order ofthe values of the amplitude envelope's elements obtained by decoding theenvelope code by taking the fact that the human audibility varies fromfrequency to frequency into consideration. It is also possible tofixedly multiplex several band-by-band codes for regions with a lowerfrequency into the multiplexed code prior to the multiplexing of anyother codes.

As can be seen from the above description, in accordance with thisembodiment 1, since the sound encoder is so constructed as to multiplexa plurality of codes into a sound code in the order determined by themultiplexing order determination unit 12 and the sound decoder is soconstructed as to demultiplex the plurality of codes from the sound codeone by one in the order determined by the demultiplexing orderdetermination unit 14, the present embodiment makes it possible toadaptively multiplex a code that exerts a large influence upon othercodes or a part of the code into a position of the sound code wherethere is a low possibility that the code or the part of the code iserroneously decoded. In other words, the present embodiment makes itpossible to implement multiplexing and demultiplexing that reflect thedistribution of bit error sensibilities which varies from frame toframe. As a result, the present embodiment offers an advantage of beingable to provide a sound encoder and a sound decoder having high biterror immunity.

Embodiment 2

FIG. 6 is a block diagram showing the structure of a sound encoderaccording to embodiment 2 of the present invention, and FIG. 7 is ablock diagram showing the structure of a sound decoder according toembodiment 2 of the present invention. In the figure, reference numeral21 denotes an encoding unit for accepting a sound signal which is thetarget to be coded, for each frame of a predetermined length, and forencoding the sound signal so as to produce a plurality of codes (aplurality of subframe-by-subframe power codes and a plurality ofsubframe-by-subframe shape codes, which are respectively provided for aplurality of subframes), reference numeral 22 denotes a multiplexingorder determination unit for determining the order in which theplurality of shape codes are to be multiplexed into a multiplexed code,based on the plurality of subframe-by-subframe power codes output fromthe encoding unit 21, reference numeral 23 denotes a multiplexing unitfor multiplexing the plurality of subframe-by-subframe shape codes andthe plurality of subframe-by-subframe power codes into the multiplexedcode in the order determined by the multiplexing order determinationunit 22, and for outputting the multiplexed result as a sound code,reference numeral 24 denotes a demultiplexing order determination unitfor determining the order in which the sound code is to be demultiplexedinto a plurality of codes, reference numeral 25 denotes a demultiplexingunit for demultiplexing the sound code into the plurality of codes(i.e., the plurality of subframe-by-subframe power codes and theplurality of subframe-by-subframe shape codes) one by one in the orderdetermined by the demultiplexing order determination unit 24 so as tooutput them, and reference numeral 26 denotes a decoding unit fordecoding the plurality of subframe-by-subframe power codes and theplurality of subframe-by-subframe shape codes respectively, which areoutput from the demultiplexing unit 25, so as to reproduce and output asound signal.

Next, a description will be made as to the operation of the soundencoder and the operation of the sound decoder. The sound encoderperforms all processes on a frame-by-frame basis, each frame having alength of 20 ms, for example. When the encoding unit 21 of the soundencoder accepts a sound signal, the encoding unit 21 encodes the soundsignal for each of two subframes (i.e., sections) into which each frameof the sound signal is divided. For each of the two subframes, theencoding unit 21 acquires a power of a signal in each of the twosubframes and then encodes the power so as to produce a power code. Theencoding unit 21 then normalizes the sound signal in each of the twosubframes with a value obtained by decoding the power code, and encodesthe normalized sound signal so as to produce a shape code. The encodingunit 21 thus performs this encoding processing on each of the twosubframes so as to produce and output two power codes, assubframe-by-subframe power codes, and two shape codes, assubframe-by-subframe shape codes.

All or part of each of the two shape codes is a variable length codesuch as a Huffman code. An envelope code and a plurality of band-by-bandcodes, which are explained in above-mentioned embodiment 1, can be usedas each of the shape codes. Each of the shape codes is not limited to acombination of an envelope code and a plurality of band-by-band codes,and one of various combinations of a spectrum code, an adaptive soundsource code, a driving sound source code, and a gain code widely used insound coding can be used as each of the shape codes.

When the multiplexing order determination unit 22 receives the pluralityof codes from the encoding unit 21, it classifies the plurality ofsubframe-by-subframe shape codes as main codes and classifies theplurality of subframe-by-subframe power codes as auxiliary codes. Themultiplexing order determination unit 22 then determines the order inwhich the plurality of subframe-by-subframe shape codes, which are maincodes, are to be multiplexed into a sound code based on the plurality ofsubframe-by-subframe power codes which are auxiliary codes. The orderdoes not simply indicate the order in which processes are to be donewith time, but indicates where the plurality of codes are to be placedin the sound code into which they are to be multiplexed by themultiplexing unit 23. Concretely, the multiplexing order determinationunit 22 provides a frame-independent fixed order for multiplexing of theplurality of subframe-by-subframe power codes which are auxiliary codes,and determines only the order, in which the main codes are to bemultiplexed into the sound code, on a frame-by-frame basis. For example,the multiplexing order determination unit 22 determines the order, inwhich the main codes are to be multiplexed into the sound code,according to the comparison between the subframe-by-subframe powersacquired by decoding the plurality of subframe-by-subframe power codeswhich are auxiliary codes. Since the subframe-by-subframe powers arecalculated as intermediate variables in the encoding unit 21, theencoding unit 21 can deliver the subframe-by-subframe powers to themultiplexing order determination unit 22 and it is therefore to omit thedecoding of the subframe-by-subframe power codes in the multiplexingorder determination unit 22.

When receiving the plurality of codes from the encoding unit 21, themultiplexing unit 23 multiplexes both the subframe-by-subframe powercodes and the subframe-by-subframe shape codes into a multiplexed codein the order determined by the multiplexing order determination unit 22,and outputs the multiplexed result as a sound code.

When receiving the sound code from the sound encoder, the demultiplexingunit 25 of the sound decoder demultiplexes only the auxiliary codesincluded in the sound code, i.e., the subframe-by-subframe power codesand then outputs them. The demultiplexing unit 25 can separate only theauxiliary codes without having to wait for inputting of the orderdetermined on a frame-by-frame basis because the order in which theauxiliary codes are to be multiplexed into the received multiplexed codeis fixed in the multiplexing order determination unit 22 of thecorresponding sound encoder.

When receiving the subframe-by-subframe power codes which are auxiliarycodes from the demultiplexing unit 25, the demultiplexing orderdetermination unit 24 determines the order in which the main codes areto be demultiplexed by the demultiplexing unit 25 based on thesubframe-by-subframe power codes. The method of determining the orderhas to be made to be the same as that used by the multiplexing orderdetermination unit 22 of the corresponding sound encoder. When the powerfor each subframe can be calculated prior to the processing done by thedemultiplexing order determination unit 24 within the decoding unit 26,it is possible to omit the decoding of the subframe-by-subframe powercodes in the demultiplexing order determination unit 24 by deliveringthe power for each subframe from the decoding unit 26 to thedemultiplexing order determination unit 24.

The demultiplexing unit 25 separates the main codes included in thesound code, i.e., the subframe-by-subframe shape codes from the soundcode in the order determined by the demultiplexing order determinationunit 24 and outputs them. When the decoding unit 26 receives thesubframe-by-subframe power codes and the subframe-by-subframe shapecodes from the demultiplexing unit 25, it decodes thesubframe-by-subframe power codes so as to calculate thesubframe-by-subframe powers and produces normalized sound signals forthe two subframes from the subframe-by-subframe shape codes,respectively. The decoding unit 26 then denormalizes the sound signalsby multiplying the subframe-by-subframe powers by the normalized soundsignals for the two subframes, respectively, and outputs the combinationof the two denormalized sound signals as a sound signal.

FIG. 8 is an explanatory drawing for explaining the subframe-by-subframepowers produced in the sound encoder. In FIG. 8, the horizontal axisindicates the time and it is assumed that the current frame is dividedinto two subframes: the first half which is referred to as the firstsubframe and the latter half which is referred to as the secondsubframe. In the figure, the sound signal for the current frame is shownin the upper part and the subframe-by-subframe powers (i.e., valuesobtained by decoding the subframe-by-subframe power codes) calculatedfor the sound signal are shown in the lower part. In the case of thesound signal of FIG. 8, the second subframe has a larger power than thefirst subframe.

FIGS. 9A and 9B are explanatory drawings for explaining the structure ofthe sound code output by the sound encoder. FIG. 9A shows an example ofthe sound code in which the first subframe has a power equal to orgreater than that of the second subframe, and FIG. 9B shows anotherexample of the sound code in which the first subframe has a power lessthan that of the second subframe, as in the case of FIG. 8. As shown inFIGS. 9A and 9B, the subframe-by-subframe power codes which areauxiliary codes are fixedly multiplexed into the head of the sound coderegardless of the difference between the power of the first subframe andthat of the second subframe. The demultiplexing order determination unit24 compares the power of the first subframe with that of the secondsubframe, and gives a higher priority to one of the subframe-by-subframeshape codes, which is associated with the subframe that provides alarger power, so that the higher-priority subframe-by-subframe shapecode is multiplexed into the sound code before the other shape code ismultiplexed.

In general, each shape code is the one into which a plurality of codesare multiplexed. Since a variable length code is used as part or all ofeach shape code, the code length of each shape code can be erroneouslyestimated when a bit error occurs. As a result, the demultiplexing unitmay separate other codes, which are placed behind a shape code at whicha bit error occurs, erroneously. Therefore, as the demultiplexing unitreaches the tail of the sound code, codes can be decoded erroneouslywith a higher probability because of the occurrence of bit errors. Asshown in FIGS. 9A and 9B, the multiplexing unit of this embodiment 2multiplexes one subframe-by-subframe shape code with a larger powerbefore multiplexing the other subframe-by-subframe shape code, therebyreducing the probability of erroneously decoding the formersubframe-by-subframe shape code with a larger power. In general, sincethe deterioration in the tone quality of the sound signal is large whena subframe-by-subframe shape code with a larger power is erroneouslydecoded, the multiplexing as shown in FIGS. 9A and 9B makes it possibleto reduce the deterioration in the tone quality of the sound signal byreducing the probability of erroneously decoding a subframe-by-subframeshape code with a larger power.

In this embodiment 2, the number of subframes included in each frame is2, but is not limited to 2. As an alternative, the number of subframesincluded in each frame can be 3 or more. Furthermore, in this embodiment2, the multiplexing unit of the sound encoder multiplexes the two powercodes respectively provided for the two subframes of each frame into asound code. As an alternative, the multiplexing unit can vector quantizethe two subframe-by-subframe powers as a single unit and encode thevector quantized result so as to produce a power code on aframe-by-frame basis. Furthermore, instead of controlling the order inwhich the first subframe's shape code and the second subframe's shapecode are to be multiplexed into the sound code, the multiplexing unit ofthe sound encoder can multiplex a part of each shape code into the soundcode in a fixed order so that it is placed immediately behind the twopower codes, and can control the order in which the remainder of thefirst subframe's shape code and the remainder of the second subframe'sshape code are to be multiplexed according to the subframe-by-subframepowers. As an alternative, the multiplexing unit of the sound encodercan divide the shape code of each subframe into a plurality of portions,and can finely control the order in which the plurality of portions areto be multiplexed according to a plurality of powers respectivelyprovided for them.

In addition, in accordance with this embodiment 2, only the two powercodes can be used, as auxiliary codes, to determine the order in whichthe first subframe's shape code and the second subframe's shape code areto be multiplexed into the sound code. The present embodiment is notlimited to the case, and any other code can be used, as an auxiliarycode, if the importance of each subframe is determined using the othercode. In this variant, the combination of the other code and the twopower codes are used as auxiliary codes, or only the other code is usedas an auxiliary code.

As can be seen from the above description, in accordance with thisembodiment 2, the sound encoder is so constructed as to multiplex aplurality of codes into a sound code in the order determined by themultiplexing order determination unit 22, and the sound decoder is soconstructed as to demultiplex the sound code into the plurality of codesone by one in the order determined by the demultiplexing orderdetermination unit 24 and to output them. The present embodimenttherefore makes it possible to adaptively multiplex a code that exerts alarge influence upon other codes or a part of the code into a positionof the sound code where there is a low possibility that the code or thepart of the code is erroneously decoded. In other words, the presentembodiment makes it possible to implement multiplexing anddemultiplexing that reflect the distribution of bit error sensibilitieswhich varies from frame to frame. As a result, the present embodimentoffers an advantage of being able to provide a sound encoder and a sounddecoder having high bit error immunity.

Embodiment 3

In a sound encoder according to a variant of either of the first tosecond embodiments, the multiplexing unit can interchange a plurality ofcodes multiplexed into a multiplexed code based on the order determinedby the multiplexing order determination unit after multiplexing theplurality of codes into the multiplexed code in a fixed order once,instead of multiplexing the plurality of codes into the multiplexed codein the determined order. Even in this case, the same advantages areprovided. Similarly, in a sound decoder according to a variant of eitherof the first to fifth embodiments, the demultiplexing unit candemultiplex an input multiplexed code into a plurality of codes in afixed order after interchanging the plurality of codes multiplexed intothe multiplexed code based on the order determined by the demultiplexingorder determination unit once, instead of demultiplexing the multiplexedcode into the plurality of codes in the determined order. Even in thiscase, the same advantages are provided.

Many widely different embodiments of the present invention may beconstructed without departing from the spirit and scope of the presentinvention. It should be understood that the present invention is notlimited to the specific embodiments described in the specification,except as defined in the appended claims.

1. A sound processing system comprising a sound encoder and a sounddecoder a sound encoder including: an encoding unit for producing anamplitude envelope as an intermediate value, the amplitude envelopeincluding a plurality of elements, and for encoding a sound signal on aframe-by-frame basis so as to produce a plurality of codes, part or allof which are variable length codes, the plurality of codes includingmain codes and an auxiliary code, the auxiliary code being producedbased on the amplitude envelope; a multiplexing order determination unitfor analyzing the amplitude envelope produced by said encoding unit toobtain an order of the value corresponding to the elements of theamplitude envelope, so as to determine an order in which the main codesare to be multiplexed; and a multiplexing unit for multiplexing the maincodes in the order determined by said multiplexing order determinationunit and multiplexing the auxiliary code in a same fixed order for eachframe; a sound decoder including: a first demultiplexing unit forreceiving a sound code on a frame-by-frame basis and for demultiplexingthe sound code into an auxiliary code which is multiplexed for eachframe in the same fixed order; a demultiplexing order determination stepfor determining an order in which the sound code is to be demultiplexedinto main codes, part or all of which are variable length codes, basedon an order of the values of the amplitude envelope's elements obtainedby an amplitude envelope as an intermediate variable which is producedby the auxiliary code; a second demultiplexing step for demultiplexingthe sound code into the main codes in the order determined by saiddemultiplexing order determination step and for outputting the maincodes; and a decoding step for decoding the main codes output from saiddemultiplexing step so as to reproduce a sound signal.
 2. A soundprocessing method comprising a sound encoding method and a sounddecoding method a sound encoding method including: an encoding step forproducing an amplitude envelope as an intermediate value, the amplitudeenvelope including a plurality of elements, and for encoding a soundsignal on a frame-by-frame basis so as to produce a plurality of codes,part or all of which are variable length codes, the plurality of codesincluding main codes and an auxiliary code, the auxiliary code beingproduced based on an amplitude envelope; a multiplexing orderdetermination step for analyzing the amplitude envelope produced by saidencoding unit to obtain an order of the value corresponding to theelements of the amplitude envelope, so as to determine an order in whichthe main codes are to be multiplexed; and a multiplexing step formultiplexing the main codes in the order determined by said multiplexingorder determination step and multiplexing the auxiliary code in a samefixed order for each frame; a sound decoding method including: a firstdemultiplexing step for receiving a sound code on a frame-by-framebasis, and for demultiplexing the sound code into an auxiliary codewhich is multiplexed for each frame in the same fixed order; ademultiplexing order determination step for determining an order inwhich the sound code is to be demultiplexed into main codes, part or allof which are variable length codes, based on an order of the values ofthe amplitude envelope's elements obtained by an amplitude envelope asan intermediate variable which is produced by the auxiliary code; asecond demultiplexing step for demultiplexing the sound code into themain codes in the order determined by said demultiplexing orderdetermination step and for outputting the main codes; and a decodingstep for decoding the main codes output from said demultiplexing step soas to reproduce a sound signal.